<div class="card">
  <div class="card-body">
    <h5 class="card-title"><%= @blog.title %></h5>
    <h6 class="card-subtitle mb-2 text-muted">作者：<%= @blog.user.email %>
      ,<%= @blog.created_at.strftime("%Y-%m-%d %H:%M:%S") %></h6>
    <p class="card-text"><%= @blog.content.html_safe %></p>
  </div>
  <div class="card-body">
    <form class="input-group mb-3" method="post" action="<%= comments_path %>">
      <input type="hidden" name="<%= request_forgery_protection_token.to_s %>" value="<%= form_authenticity_token %>">
      <input type="text" name="content" required class="form-control" placeholder="发表评论">
      <input type="text" hidden name="blog_id" value="<%= @blog.id %>">
      <div class="input-group-append">
        <input type="submit" class="btn btn-primary" name="发送">
      </div>
    </form>
  </div>
  <% @comments.each do |comment| %>
    <div class="card-footer">
      <div class="card border-success mb-3">
        <div class="card-header bg-transparent border-success"><%= comment.user.email %>
          <%= comment.created_at.strftime("%Y-%m-%d %H:%M:%S") %>
        </div>
        <div class="card-body text-success">
          <p class="card-text"><%= comment.content %></p>
        </div>
      </div>
    </div>
  <% end -%>

</div>